package com.xxx.video.commen.utils;

import android.text.TextUtils;

import androidx.annotation.StringRes;

import com.xxx.video.VideoApplication;


public class StringUtils {
    private static StringUtils mStringUtils = null;

    private StringUtils() {
    }

    public static StringUtils getInstance() {
        if (mStringUtils == null) {
            synchronized (StringUtils.class) {
                if (mStringUtils == null) {
                    mStringUtils = new StringUtils();
                }
            }
        }
        return mStringUtils;
    }

    /**
     * get a string
     *
     * @param id String res id
     * @return String
     */
    public String getString(@StringRes int id) {
        return VideoApplication.getInstance().getResources().getString(id);
    }

    /**
     * filter null String
     *
     * @param text text
     * @return string
     */
    public String getNotEmptyMsg(String text) {
        if (TextUtils.isEmpty(text)) {
            return "";
        }
        return text;
    }
}
